package com.hwz.mapper;

import com.github.pagehelper.Page;
import com.hwz.dto.GoodsSalesDTO;
import com.hwz.dto.OrdersPageQueryDTO;
import com.hwz.entity.Orders;
import org.apache.ibatis.annotations.Mapper;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

@Mapper
public interface OrderMapper {
    void insert(Orders order);
    /**
     * 根据订单号和用户id查询订单
     * @param orderNumber
     * @param userId
     */
    Orders getByNumberAndUserId(String orderNumber, Long userId);

    /**
     * 修改订单信息
     * @param orders
     */
    void update(Orders orders);

    Orders getByIdAndUserId(Long id, Long userId);

    Integer statisticsOrder(Integer status);

    Orders getById(Long orderId);


    Page<Orders> pageQuery(OrdersPageQueryDTO ordersPageQueryDTO);

    List<Orders> getByStatusAndOrdertimeLT(Integer pendingPayment, LocalDateTime localDateTime);

    double sumByMap(Map map);

    Integer countByMap(Map map);

    List<GoodsSalesDTO> top10(LocalDateTime begin, LocalDateTime end);
}
